package com.jnu.hospitalexamination.common;

import lombok.Data;
import lombok.NoArgsConstructor;
@Data
public class Result {
    private Integer code;

    private String message;

    private Object data;

    //创建相应成功的响应体
    public static Result success(Integer code, String message, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    //创建服务失败的响应体，不要让服务自动返回500错误
    public static Result error(Integer code, String message, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }


}
